// SPDX-FileCopyrightText: 2023-2025 Sangfor Technologies Inc.
// SPDX-License-Identifier: Mulan PSL v2
package validate

import (
	"code.geniusai.org/notebook-manager/pkg/entity"
	"code.geniusai.org/notebook-manager/pkg/resource"
)

func ValidateCreateNotebook(resourceManager *resource.Manager, notebook *entity.Notebook) error {
	if notebook.VGpuNum != 0 && notebook.VGpuDisplayName == "" {
		return entity.NewCodeError(entity.MsgParamInvalid)
	}
	if notebook.VGpuDisplayName != "" && notebook.VGpuNum == 0 {
		return entity.NewCodeError(entity.MsgParamInvalid)
	}
	if notebook.Name == "" {
		return entity.NewCodeError(entity.MsgParamInvalid)
	}
	if resourceManager.CheckNotebookNameIfExist(notebook.Name, notebook.UserID) {
		return entity.NewErrorf(entity.CodeParamInvalid, entity.MsgNotebookExisted, notebook.Name)
	}
	return nil
}

func ValidateModifyNotebook(resourceManager *resource.Manager, notebook *entity.ModifyNotebook) error {
	// TODO
	return nil
}
